CC=$(CROSS_COMPILE)gcc

SRC = $(wildcard /home/wangxin/data/src/work2/mqttclient/*.c \
        /home/wangxin/data/src/work2/mqttclient/common/*.c \
        /home/wangxin/data/src/work2/mqttclient/common/log/*.c \
        /home/wangxin/data/src/work2/mqttclient/common/log/arch/linux/*.c \
        /home/wangxin/data/src/work2/mqttclient/network/mbedtls/library/*.c \
        /home/wangxin/data/src/work2/mqttclient/network/mbedtls/wrapper/*.c \
        /home/wangxin/data/src/work2/mqttclient/mqtt/*.c \
        /home/wangxin/data/src/work2/mqttclient/mqttclient/*.c \
        /home/wangxin/data/src/work2/mqttclient/network/*.c \
        /home/wangxin/data/src/work2/mqttclient/platform/linux/*.c \
        )

INC =   -lpthread \
        -I/home/wangxin/data/src/work2/mqttclient/common \
        -I/home/wangxin/data/src/work2/mqttclient/common/log \
        -I/home/wangxin/data/src/work2/mqttclient/network/mbedtls/include \
        -I/home/wangxin/data/src/work2/mqttclient/network/mbedtls/include/mbedtls \
        -I/home/wangxin/data/src/work2/mqttclient/network/mbedtls/wrapper \
        -I/home/wangxin/data/src/work2/mqttclient/mqtt \
        -I/home/wangxin/data/src/work2/mqttclient/mqttclient \
        -I/home/wangxin/data/src/work2/mqttclient/network \
        -I/home/wangxin/data/src/work2/mqttclient/platform/linux \
        -I/home/wangxin/data/src/work2/mqttclient/config

OBJS = $(patsubst %.c, %.o, $(SRC))

FLAG = -g -fpic -I. -Iinclude $(INC) 
TARGET = libmqttclient.so


$(TARGET):$(OBJS)
	$(CC) -shared $^ -o $@

%.o:%.c
	$(CC) -c $(FLAG) $^ -o $@

clean:
	rm -rf $(TARGET) $(OBJS)

install:
	sudo cp -rdf $(TARGET) /usr/lib/.

remove:
	sudo rm -rdf /usr/lib/$(TARGET)

.PHONY:clean
